﻿using System.Web.Http;
using ML.IBusiness;

namespace ML.WebApi.Controllers
{
    /// <summary>
    /// 平台分类api接口
    /// </summary>
    [CrossSite]
    public class PlatformCategoryController : BaseApiController
    {
        private readonly IPlatFormCategoryBusiness platformBusiness;
        public PlatformCategoryController(IPlatFormCategoryBusiness platformBusiness)
        {
            this.platformBusiness = platformBusiness;
        }

        /// <summary>
        /// 查询所有可用的未删除平台分类列表
        /// </summary>
        /// <returns></returns>
        [Route("api/platform/getallenablelist")]
        [HttpGet]
        public IHttpActionResult GetAllEnableList()
        {
            var data = platformBusiness.GetAllEnableList();
            return Json(data);
        }

        /// <summary>
        /// 前端已经在使用此接口—查询所有可用的未删除的平台分类列表信息
        /// </summary>
        /// <param name="pagesize">每页显示多少条数据</param>
        /// <returns></returns>
        [Route("api/platform/getpageenablelist")]
        [HttpGet]
        public IHttpActionResult GetPageEnableList(int pagesize = 8)
        {
            var data = platformBusiness.GetPageEnableList(pagesize);
            return Json(data);
        }

        /// <summary>
        /// 查询所有可用的未删除平台分类列表（微信小程序）
        /// </summary>
        /// <returns></returns>
        [Route("api/wx/platform/getallenablelistforwx")]
        [HttpGet]
        public IHttpActionResult GetAllEnableListForWx()
        {
            var data = platformBusiness.GetAllEnableList();
            return Json(data);
        }
    }
}